package com.jbp.service;

import com.alibaba.fastjson.JSON;
import com.jbp.exception.RRException;
import com.jbp.model.*;
import com.jbp.redis.RedisConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.io.FileInputStream;
import java.io.FileWriter;
import java.math.BigDecimal;
import java.util.*;

/**
 * 飞鱼1210 4元小蛋
 */
@Service
public class LuckyUtil43 {
    @Autowired
    private RedisConfigService redisConfigService;

    @Autowired
    private PropertyService propertyService;

    @Autowired
    private UserService userService;
    @Autowired
    private LuckPoolUserService luckPoolUserService;
    @Autowired
    private LuckPoolRoomService luckPoolRoomService;
    //每次抽消耗奖金币
    public static final int price = 40;
    @Autowired
    private LuckyUtil luckyUtil;

    public List<Gift> luck(Integer userId, int times, List<GiftLot> list, int patch, Integer roomId) {

        //系统总爆率
        double winRate;
        double winRateA = Double.parseDouble(propertyService.getV("winRateAFour"));
        double winRateB = Double.parseDouble(propertyService.getV("winRateBFour"));
        double winRateC = Double.parseDouble(propertyService.getV("winRateCFour"));
        double winRateD = Double.parseDouble(propertyService.getV("winRateDFour"));

        //奖池礼物数量
        int poolSize = Integer.parseInt(propertyService.getV("pool_size"));
        int minPoolSize = Integer.parseInt(propertyService.getV("min_pool_size"));
        int maxGift = Integer.parseInt(propertyService.getV("maxGift"));
        double jcBeishu = Double.parseDouble(propertyService.getV("pool_times"));

        String keyUpay = "haoya:luck:"+price+":upay:"+userId;
        String keyUincmoe = "haoya:luck:"+price+":uincome:"+userId;
        String keyUTotalPay = "haoya:luck:"+price+":utotalpay:"+userId;
        String keyUTotalIncome = "haoya:luck:"+price+":utotalincome:"+userId;
        String keyUmap = "haoya:luck:"+price+":umap:"+userId;

        int pay = redisConfigService.getInt(keyUpay);
        int income = redisConfigService.getInt(keyUincmoe);
        int totalPay = redisConfigService.getInt(keyUTotalPay);
        int totalIncome = redisConfigService.getInt(keyUTotalIncome);

        double userBaseRate = luckyUtil.getBaseRate(roomId, userId, totalPay);

        //判断奖池
        String poolName;
        int type;
        int biggest = 200000;
        double basePoolRate = 1;
        if (totalPay+times*price<20000) {
            poolName = "A";
            type = 1;
            winRate = winRateA;
            biggest = 20000;
        } else if (totalPay+times*price<100000) {
            poolName = "B";
            type = 2;
            winRate = winRateB;
        } else if (totalPay+times*price<300000) {
            poolName = "C";
            type = 3;
            winRate = winRateC;
        } else {
            poolName = "D";
            type = 4;
            winRate = winRateD;
        }

        LuckPoolRoom luckPoolRoom = luckPoolRoomService.getByRoomId(roomId);
        LuckPoolUser luckPoolUser = luckPoolUserService.getByUserId(userId);
        String poolPrex = "";
        if (luckPoolUser!=null) {
            poolPrex = "u:"+userId+":";
            winRate *= luckPoolUser.getRate().doubleValue() / 1.17d;
        } else if (luckPoolRoom!=null) {
            poolPrex = "r:"+roomId+":";
            winRate *= luckPoolRoom.getRate().doubleValue() / 1.17d;
        }

        double patchRate = winRate<1.17 ? 1.17-winRate : 0;

        Node nodeTree = getNodeTree(type);

        String keyAllincome= "haoya:luck:"+price+":allincome:"+poolPrex+poolName;
        String keyAllpay = "haoya:luck:"+price+":allpay:"+poolPrex+poolName;
        String keyPool = "haoya:luck:"+price+":pool:"+poolPrex+poolName;
        String keyGiftCount = "haoya:luck:"+price+":giftcount:"+poolPrex+poolName;
        String keyPatchPool = "haoya:luck:patchpool";
        String keyPoolMap = "haoya:luck:"+price+":pollmap:"+poolPrex+type;

        int allIncome = redisConfigService.getInt(keyAllincome);
        int allPay = redisConfigService.getInt(keyAllpay);
        int pool = redisConfigService.getInt(keyPool);
        int giftCount = redisConfigService.getInt(keyGiftCount);
        int patchPool = redisConfigService.getInt(keyPatchPool);

        //用户积分树
        String ujson = (String) redisConfigService.get(keyUmap);
        Map<String, Integer> userNMap = (Map<String, Integer>) JSON.parse(ujson);
        if (userNMap==null) {
            userNMap = new LinkedHashMap<>();
        }

        //奖池积分树
        String pjson = (String) redisConfigService.get(keyPoolMap);
        Map<String, Integer> allNMap = (Map<String, Integer>) JSON.parse(pjson);
        if (allNMap==null) {
            allNMap = new LinkedHashMap<>();
        }

        //生成奖池
        if (giftCount<=minPoolSize) {
            giftCount += poolSize;
            pool += poolSize * winRate * price;
            if (pool>giftCount*1.19*price) {
                pool = (int) (giftCount*1.19*price);
            }
            System.out.println("生成奖池："+pool+" winRate："+winRate);
            patchPool += poolSize * patchRate * price;
        }

        List<Gift> result = new ArrayList<>();
        for (int i = 0; i < times; i++) {
            giftCount --;
            pay += price;
            totalPay += price;
            allPay += price;

            //用户最大奖限制
            biggest = Math.min(biggest, (int) (pool/jcBeishu));
            int min = 1;
            int luck;
            biggest = Math.min(biggest, maxGift);
            biggest = Math.max(biggest, 6666);
            biggest = Math.min(biggest, 131400);

            if (patch==0) {
                int protectPrice = protectPrice(totalPay, totalIncome);
                if (protectPrice > 0) {
                    biggest = Math.min(biggest, 50000);
                    min = protectPrice;
                }
            }

            min=Math.min(min, 20000);
            min = Math.min(min, biggest);
            min = Math.min(min, 5200);

            double poolRate = LuckyUtil.getPoolRate(pool, giftCount, winRate, price);
            poolRate = Math.min(poolRate, 1.2d);
            luck = LuckyUtil.nodeLuck(nodeTree, poolRate, min, biggest, userNMap, allNMap, basePoolRate*userBaseRate);

            if (luck>2000) {
                patch++;
            }

            //将奖品转化为礼物
            Gift gift = null;
            for (GiftLot giftLot : list) {
                if (giftLot.getGift().getCoin() == luck) {
                    gift = giftLot.getGift();
                    break;
                }
            }

            if (gift==null) {
                throw new RRException("网络错误");
            }

            income += gift.getCoin();
            totalIncome += gift.getCoin();
            allIncome += gift.getCoin();
            pool -= gift.getCoin();
            result.add(gift);
        }

        pool = Math.min(pool, (int) (giftCount*1.18*price+30000));

        redisConfigService.set(keyAllincome, allIncome);
        redisConfigService.set(keyAllpay, allPay);
        redisConfigService.set(keyPool, pool);
        redisConfigService.set(keyPatchPool, patchPool);
        redisConfigService.set(keyGiftCount, giftCount);
        redisConfigService.set(keyUpay, pay);
        redisConfigService.set(keyUincmoe, income);
        redisConfigService.set(keyUTotalPay, totalPay);
        redisConfigService.set(keyUTotalIncome, totalIncome);
        redisConfigService.set(keyUmap, JSON.toJSONString(userNMap));
        redisConfigService.set(keyPoolMap, JSON.toJSONString(allNMap));
        return result;
    }

    public int protectPrice(int totalPay, int totalIncome) {
        double protectedRate = 0;
        if (totalPay>500000) {
            protectedRate = 1.02;
        } else if (totalPay > 250000) {
            protectedRate = 0.98;
        } else if (totalPay>95000) {
            protectedRate = 0.95;
        } else if (totalPay>70000) {
            protectedRate = 0.8;
        } else if (totalPay>50000) {
            protectedRate = 0.6;
        } else if (totalPay>8000) {
            protectedRate = 0.55;
        }
        int min = 0;
        if (protectedRate>0 && totalPay*protectedRate > totalIncome) {
            min = (int) (totalPay*protectedRate-totalIncome);
            if (totalPay>500000) {
                min = Math.max(min, 5000);
            } else if (totalPay>250000) {
                min = Math.max(min, 1000);
            } else if (totalPay>160000) {
                min = Math.max(min, 500);
            }
        }
        return min;
    }

    Pool poolA = new Pool();
    Pool poolB = new Pool();
    Pool poolC = new Pool();
    Pool poolD = new Pool();

    @SuppressWarnings("AliControlFlowStatementWithoutBraces")
    void luckTest(UserLuck userLuck, Map <Integer, Integer> out) {
        //总爆率
        double winRate;

        Pool pl;
        Node nodeTree;
        int type;

        //用户最大奖限制
        int min = 1;

        int biggest = 70000;
        biggest = Math.max(biggest, 6000);

        if (userLuck.totalPay<20000) {
            pl = poolA;
            type =1;
            winRate = 1.17;
        } else if (userLuck.totalPay<100000) {
            pl = poolB;
            type = 2;
            winRate = 1.155;
        } else if (userLuck.totalPay<500000) {
            pl = poolC;
            type = 3;
            winRate = 1.15;
        } else {
            pl = poolD;
            type = 4;
            winRate = 1.14;
        }
        nodeTree = getNodeTree(type);

        //生成奖池
        if (pl.giftCount<10000) {
            pl.giftCount += pl.giftSize;
            pl.pool += pl.giftSize * winRate * price;
        }

        pl.giftCount --;
        userLuck.pay += price;
        userLuck.totalPay += price;
        userLuck.currPay += price;
        pl.allPay += price;

        biggest = Math.min(biggest, pl.pool/5);


        double protectedRate = 0;
        int totalPay = userLuck.totalPay;
        int totalIncome = userLuck.totalIncome;
        if (totalPay>500000) {
            protectedRate = 1.02;
        } else if (totalPay > 250000) {
            protectedRate = 0.98;
        } else if (totalPay>95000) {
            protectedRate = 0.95;
        } else if (totalPay>70000) {
            protectedRate = 0.8;
        } else if (totalPay>50000) {
            protectedRate = 0.6;
        } else if (totalPay>8000) {
            protectedRate = 0.55;
        }
        if (protectedRate>0 && totalPay*protectedRate > totalIncome) {
            min = (int) (totalPay*protectedRate-totalIncome);
            biggest = Math.min(biggest, 50000);
            if (totalPay>500000) {
                min = Math.max(min, 5000);
            } else if (totalPay>250000) {
                min = Math.max(min, 1000);
            } else if (totalPay>160000) {
                min = Math.max(min, 500);
            }  else {
                min = Math.max(min, 100);
            }
        }

        min=Math.min(min, 20000);

        min = Math.min(min, biggest);

        double poolRate = LuckyUtil.getPoolRate(pl.pool, pl.giftCount, winRate, price);
        Map<String, Integer> nMap = getUserNMap(userLuck.id);
        Map<String, Integer> allMap = getPoolNMap(type);
        int luck = LuckyUtil.nodeLuck(nodeTree, poolRate, min, biggest, nMap, allMap, 1);

        userLuck.income += luck;
        userLuck.totalIncome += luck;
        userLuck.currIncome += luck;
        pl.allIncome += luck;
        pl.pool -= luck;

        if (out.containsKey(luck)) {
            out.put(luck, out.get(luck)+1);
        } else {
            out.put(luck, 1);
        }
    }


    /**
     * A奖池 投入1w钻以内
     */
    private static Map <Integer, Integer> getGiftCoinfigA() {
        Map<Integer, Integer> map = new LinkedHashMap<>();
        map.put(8, 12000);
        map.put(13, 3800);
        map.put(18, 2500);
        map.put(28, 1100);
        map.put(58, 100);
        map.put(88, 100);
        map.put(188, 100);
        map.put(518, 220);
        map.put(888, 100);
        map.put(2188, 70);
        map.put(3388, 45);
        map.put(5188, 25);
        map.put(9999, 3);
        map.put(13888, 1);
        return map;
    }
    /**
     * B奖池 投入10w钻以内
     */
    private static Map <Integer, Integer> getGiftCoinfigB() {
        Map<Integer, Integer> map = new LinkedHashMap<>();
        map.put(8, 36000);
        map.put(13, 10400);
        map.put(18, 7500);
        map.put(28, 3300);
        map.put(58, 300);
        map.put(88, 300);
        map.put(188, 290);
        map.put(518, 600);
        map.put(888, 180);
        map.put(2188, 115);
        map.put(3388, 90);
        map.put(5188, 100);
        map.put(9999, 19);
        map.put(13888, 7);
        map.put(26888, 3);
        map.put(33888, 2);
        return map;
    }

    /**
     * C奖池 投入50w钻以下
     */
    private static Map <Integer, Integer> getGiftCoinfigC() {
        Map<Integer, Integer> map = new LinkedHashMap<>();
        map.put(8, 35500);
        map.put(13, 10400);
        map.put(18, 7500);
        map.put(28, 3300);
        map.put(58, 300);
        map.put(88, 300);
        map.put(188, 200);
        map.put(518, 500);
        map.put(888, 148);
        map.put(2188, 80);
        map.put(3388, 78);
        map.put(5188, 90);
        map.put(9999, 19);
        map.put(13888, 9);
        map.put(26888, 5);
        map.put(33888, 3);
        map.put(55888, 2);
        return map;
    }

    /**
     * D奖池 投入50w钻以上
     */
    private static Map <Integer, Integer> getGiftCoinfigD() {
        Map<Integer, Integer> map = new LinkedHashMap<>();
        map.put(8, 33000);
        map.put(13, 10400);
        map.put(18, 7500);
        map.put(28, 3300);
        map.put(58, 200);
        map.put(88, 200);
        map.put(188, 200);
        map.put(518, 400);
        map.put(888, 110);
        map.put(2188, 55);
        map.put(3388, 65);
        map.put(5188, 75);
        map.put(9999, 14);
        map.put(13888, 9);
        map.put(26888, 7);
        map.put(33888, 5);
        map.put(55888, 2);
        map.put(68888, 1);
        return map;
    }


    /**
     1. 存储用户每个礼物对应的N值 默认为1 未抽中+1 抽中置为1
     2. prd算法 P(实际概率)=C(基础爆率)*N(抽奖次数)
     */
    private static Map<Integer, Map<Integer, Integer>> userNMap = new HashMap<>();

    /**
     * 获取用户真实爆率表
     * 实际礼物爆率为 礼物基础爆率*N
     * */
    private static Map<Integer, Integer> getGiftConfig(Integer userId) {
        Map<Integer, Integer> nMap = userNMap.get(userId);
        Map<Integer, Integer> giftCoinfig = getGiftCoinfigA();
        Map<Integer, Integer> result = new LinkedHashMap<> ();
        for (Integer price : giftCoinfig.keySet()) {
            result.put(price, giftCoinfig.get(price));
            if (nMap!=null && nMap.containsKey(price)) {
                result.put(price, (int) (giftCoinfig.get(price)*nMap.get(price)));
            }
        }
        return result;
    }

    /**
     * 抽中礼物 跟新N值
     * @Param luck 当次中间礼物
     * */
    private static void updateLuck(Integer userId, Integer luck) {
        Map<Integer, Integer> nMap = userNMap.get(userId);
        if (nMap==null) {
            nMap = new LinkedHashMap<>();
            for (Integer k : getGiftCoinfigC().keySet()) {
                nMap.put(k, 1);
            }
        }
        for (Integer  price: nMap.keySet()) {
            if (price.equals(luck)) {
                nMap.put(price, 1);
            } else {
                nMap.put(price, nMap.get(price)+1);
            }
        }

        userNMap.put(userId, nMap);
    }

    private static Node getNodeTree(Map<String, Integer> map){
        Node i2 = new Node("i2", new Node(55888), new Node(68888), map);
        Node i1 = new Node("i1", new Node(26888), new Node(33888), map);
        Node h2 = new Node("h2", i1, i2, map);
        Node h1 = new Node("h1", new Node(9999), new Node(13888), map);
        Node g2 = new Node("g2", h1, h2, map);
        Node g1 = new Node("g1", new Node(3388), new Node(5188), map);
        Node f2 = new Node("f2", g1, g2, map);
        Node f1 = new Node("f1", new Node(888), new Node(2188), map);
        Node e1 = new Node("e1", new Node(188), new Node(518), map);
        Node e2 = new Node("e2", f1, f2, map);
        Node d1 = new Node("d1", new Node(58), new Node(88), map);
        Node d2 = new Node("d2", e1, e2, map);
        Node c1 = new Node("c1", new Node(18), new Node(28), map);
        Node c2 = new Node("c2", d1, d2, map);
        Node b1 = new Node("b1", new Node(8), new Node(13), map);
        Node b2 = new Node("b2", c1, c2, map);
        return new Node("a", b1, b2, map);
    }

    private static Map <String, Integer> getCMap1() {
        Map<String, Integer> map = new LinkedHashMap<>();
        map.put("a", 639);
        map.put("b1", 787);
        map.put("b2", 431);
        map.put("c1", 1217);
        map.put("c2", 6360);
        map.put("d1", 2989);
        map.put("d2", 2291);
        map.put("e1", 5386);
        map.put("e2", 1203);
        map.put("f1", 2094);
        map.put("f2", 45);
        map.put("g1", 1617);
        map.put("g2", 0);
        map.put("h1", 846);
        map.put("h2", 0);
        return map;
    }
    private static Map <String, Integer> getCMap2() {
        Map<String, Integer> map = new LinkedHashMap<>();
        map.put("a", 639);
        map.put("b1", 684);
        map.put("b2", 349);
        map.put("c1", 1217);
        map.put("c2", 5671);
        map.put("d1", 2989);
        map.put("d2", 1704);
        map.put("e1", 4968);
        map.put("e2", 2203);
        map.put("f1", 1982);
        map.put("f2", 284);
        map.put("g1", 3266);
        map.put("g2", 367);
        map.put("h1", 968);
        map.put("h2", 0);
        map.put("i1", 1982);
        return map;
    }
    private static Map <String, Integer> getCMap3() {
        Map<String, Integer> map = new LinkedHashMap<>();
        map.put("a", 653);
        map.put("b1", 774);
        map.put("b2", 179);
        map.put("c1", 1217);
        map.put("c2", 5640);
        map.put("d1", 2989);
        map.put("d2", 1682);
        map.put("e1", 4968);
        map.put("e2", 3198);
        map.put("f1", 1424);
        map.put("f2", 631);
        map.put("g1", 3400);
        map.put("g2", 1933);
        map.put("h1", 1925);
        map.put("h2", 549);
        map.put("i1", 2140);
        map.put("i2", 1424);
        return map;
    }
    private static Map <String, Integer> getCMap4() {
        Map<String, Integer> map = new LinkedHashMap<>();
        map.put("a", 653);
        map.put("b1", 774);
        map.put("b2", 179);
        map.put("c1", 1217);
        map.put("c2", 5640);
        map.put("d1", 2989);
        map.put("d2", 1682);
        map.put("e1", 4968);
        map.put("e2", 3198);
        map.put("f1", 1424);
        map.put("f2", 631);
        map.put("g1", 3400);
        map.put("g2", 1933);
        map.put("h1", 1925);
        map.put("h2", 549);
        map.put("i1", 2140);
        map.put("i2", 1424);
        return map;
    }

    static Node node1;
    static Node node2;
    static Node node3;
    static Node node4;

    private static Node getNodeTree(int type){
        if (type == 1) {
            if (node1==null) {
                node1 = getNodeTree(getCMap1());
            }
            return node1;
        } else if (type == 2) {
            if (node2==null) {
                node2 = getNodeTree(getCMap2());
            }
            return node2;
        }  else if (type == 3) {
            if (node3==null) {
                node3 = getNodeTree(getCMap3());
            }
            return node3;
        } else {
            if (node4==null) {
                node4 = getNodeTree(getCMap4());
            }
            return node4;
        }
    }

    private static Map<Integer, Map<String, Integer>> userNMap1 = new HashMap<>();
    private static Map<Integer, Map<String, Integer>> poolNMap = new HashMap<>();

    /**奖池总积分树*/
    static Map<String, Integer> getPoolNMap(int type) {
        Map<String, Integer> nMap = poolNMap.get(type);
        if (nMap==null) {
            nMap = new LinkedHashMap<>();
            poolNMap.put(type, nMap);
        }
        return nMap;
    }

    /**用户积分树*/
    static Map<String, Integer> getUserNMap(int id) {
        Map<String, Integer> nMap = userNMap1.get(id);
        if (nMap==null) {
            nMap = new LinkedHashMap<>();
            userNMap1.put(id, nMap);
        }
        return nMap;
    }

    /**
     * 抽中礼物 跟新N值
     * @Param luck 当次中间礼物
     * */
    private static void updateLuck1(Integer userId, String... names) {
        Map<String, Integer> nMap = userNMap1.get(userId);
        if (nMap==null) {
            nMap = new LinkedHashMap<>();
            for (String k : getCMap1().keySet()) {
                nMap.put(k, 1);
            }
        }

        List list = CollectionUtils.arrayToList(names);
        for (String  k: nMap.keySet()) {
            if (list.contains(k)) {
                nMap.put(k, 1);
            } else {
                nMap.put(k, nMap.get(k)+1);
            }
        }

        userNMap1.put(userId, nMap);
    }

    static void testLuck2(Map <String, Integer> map){

        Map<Integer, Integer> out = new HashMap<>();
        for (int j = 0; j < 1; j++) {
            int id = 1;
            for (int i = 0; i < 1000000; i++) {
                Map<String, Integer> nMap = getUserNMap(i);
                Map<String, Integer> allMap = getPoolNMap(1);
                int luck = LuckyUtil.nodeLuck(getNodeTree(map), 1, 1, 2000000, nMap, allMap, 1);

                if (out.containsKey(luck)) {
                    out.put(luck, out.get(luck) + 1);
                } else {
                    out.put(luck, 1);
                }
            }
        }
        LuckyUtil.printConfig(out, price);
    }

    public static void main(String[] args) {
//        LuckyUtil.geneTree();

        System.out.println("-------A-------");
        LuckyUtil.printConfig(getGiftCoinfigA(), price);
        System.out.println("-------B-------");
        LuckyUtil.printConfig(getGiftCoinfigB(), price);
        System.out.println("--------C------");
        LuckyUtil.printConfig(getGiftCoinfigC(), price);
        System.out.println("-------D-------");
        LuckyUtil.printConfig(getGiftCoinfigD(), price);

        /*LuckyUtil.printConfig(getGiftCoinfigB(), price);
        System.out.println("--------------");
        testLuck2(getCMap2());
        System.out.println("--------------");
        LuckyUtil.calPercent(getNodeTree(getCMap2()), getGiftCoinfigB());*/

       /* LuckyUtil43 luckyUtil = new LuckyUtil43();
        Map <Integer, Integer> result = new LinkedHashMap<>();
        List<UserLuck> userLucks = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            UserLuck user = new UserLuck();
            user.id=i;
            while (true) {
                luckyUtil.luckTest(user, result);
//                if (user.totalPay>=1000000 || (user.totalIncome*0.85d-user.totalPay>0)) {
                if (user.totalPay>=10000000) {
                    double rate  = BigDecimal.valueOf(user.totalIncome).divide(BigDecimal.valueOf(user.totalPay), 4, BigDecimal.ROUND_HALF_UP).doubleValue();
                    System.out.println(i+": 投入："+user.totalPay+" 产出:"+user.totalIncome +"  爆率:"+rate+ " 实际盈利："+(int)(user.totalIncome*0.85d-user.totalPay));
                    break;
                }
            }
            userLucks.add(user);
        }

        LuckyUtil.printConfig(result, price);

        LuckyUtil.tjUser(userLucks);

        System.out.println("------------系统爆率------------");
        System.out.println("A 系统投入:"+luckyUtil.poolA.allPay+" 产出:"+luckyUtil.poolA.allIncome+" 总爆率:"+ ((double)luckyUtil.poolA.allIncome/luckyUtil.poolA.allPay)+" 奖池剩余："+luckyUtil.poolA.giftCount+" 剩余爆率:"+((double)luckyUtil.poolA.pool/price/luckyUtil.poolA.giftCount));
        System.out.println("B 系统投入:"+luckyUtil.poolB.allPay+" 产出:"+luckyUtil.poolB.allIncome+" 总爆率:"+ ((double)luckyUtil.poolB.allIncome/luckyUtil.poolB.allPay)+" 奖池剩余："+luckyUtil.poolB.giftCount+" 剩余爆率:"+((double)luckyUtil.poolB.pool/price/luckyUtil.poolB.giftCount));
        System.out.println("C 系统投入:"+luckyUtil.poolC.allPay+" 产出:"+luckyUtil.poolC.allIncome+" 总爆率:"+ ((double)luckyUtil.poolC.allIncome/luckyUtil.poolC.allPay)+" 奖池剩余："+luckyUtil.poolC.giftCount+" 剩余爆率:"+((double)luckyUtil.poolC.pool/price/luckyUtil.poolC.giftCount));
        System.out.println("D 系统投入:"+luckyUtil.poolD.allPay+" 产出:"+luckyUtil.poolD.allIncome+" 总爆率:"+ ((double)luckyUtil.poolD.allIncome/luckyUtil.poolD.allPay)+" 奖池剩余："+luckyUtil.poolD.giftCount+" 剩余爆率:"+((double)luckyUtil.poolD.pool/price/luckyUtil.poolD.giftCount));
        System.out.println("总 系统投入:"+(luckyUtil.poolA.allPay+luckyUtil.poolB.allPay+luckyUtil.poolC.allPay+luckyUtil.poolD.allPay)+
                " 产出:"+(luckyUtil.poolA.allIncome+luckyUtil.poolB.allIncome+luckyUtil.poolC.allIncome+luckyUtil.poolD.allIncome)+
                " 总爆率:"+ ((double)(luckyUtil.poolA.allIncome+luckyUtil.poolB.allIncome+luckyUtil.poolC.allIncome+luckyUtil.poolD.allIncome)/(luckyUtil.poolA.allPay+luckyUtil.poolB.allPay+luckyUtil.poolC.allPay+luckyUtil.poolD.allPay)));
    */}
}

